﻿using DevExpress.XtraBars.Docking;
using Rail.Base;
using Rail.Demo.Viewer;
using System.Collections.Generic;

namespace Rail.Demo.Controller
{
    public class CreateDemoFormCommand3 : Base.BaseCommand
    {
        public override void Execute(PureMVC.Interfaces.INotification notification)
        {
            var objs = notification.Body as List<object>;
            var obj = objs[0];
            IFormMain ifm = obj as IFormMain;
            // 创建Panel
            DockPanel taticsPanel = ifm.DockManager().AddPanel(DockingStyle.Left);
            taticsPanel.DockTo(ifm.LeftDockPanel());
            taticsPanel.Text = "示例Panel";

            // 创建窗体
            DemoDockPanelContent taticsForm = new DemoDockPanelContent();

            // 将窗体的顶级属性设为假，若无此设置，直接加载窗体会报错：无法将顶级控件加载到控件
            taticsPanel.Controls.Add(taticsForm);

            taticsForm.Dock = System.Windows.Forms.DockStyle.Fill;
            taticsForm.Show();
        }
    }
}
